#include <stdio.h>
#include <stdlib.h>

typedef struct student {
	char name[20];
		int age;
}student;

int con_int( int const* a, int const* b)
{
	return *a - *b;
}

int con_char(char const* a, char const* b)
{
	return (int)*a - (int)*b;

}

int con_stu_age(const student* a, const student* b)
{
	return (a->age) - (b->age);
}

int main()
{
	int arr[10] = { 1,3,52,343,55,45,436,5,3453,423 };
	char brr[10] = "ncjsaidwoa";
	qsort(arr, sizeof(arr) / sizeof(arr[0]), sizeof(arr[0]), con_int);
	int i = 0;
	for (i = 0; i < sizeof(arr) / sizeof(arr[0]); i++)
	{
		printf("%d  ", arr[i]);
	}
	printf("\n");
	qsort(brr, sizeof(brr) / sizeof(brr[0]), sizeof(brr[0]), con_char);
	for (i = 0; i < sizeof(brr) / sizeof(brr[0]); i++)
	{
		printf("%c  ", brr[i]);
	}
	printf("\n");
	student stu[5] = { {"zhangsan",15} ,{"lisi",18},{"wangwu",14}, {"jack",16},{"mark",17} };
	qsort(stu, sizeof(stu) / sizeof(stu[0]), sizeof(stu[0]), con_stu_age);
	for (i = 0; i < sizeof(stu) / sizeof(stu[0]); i++)
	{
		printf("%s\n", stu[i].name);
	}

	return 0;
}